export function timeFormat(time) {
  let date = new Date()
  date.setTime(time * 1000)
  let y = date.getFullYear()
  let m = toTwo(date.getMonth() + 1)
  let d = toTwo(date.getDate())
  let h = toTwo(date.getHours())
  let mm = toTwo(date.getMinutes())
  let s = toTwo(date.getSeconds())
  return y + '-' + m + '-' + d + ' ' + h + ':' + mm + ':' + s
}

function toTwo(value) {
  if (value < 10) {
    return '0' + value
  }
  return value
}
